#ifndef _EVENT_HPP_
#define _EVENT_HPP_

class EventSender;
class EventReceiver;

class Event
{
  // $$公共接口
 public:
  long           eventID;                      //事件id

  virtual
  const char*    getType() const;              //事件类型（id的字符串形式）
  EventSender*   getSender() const             //事件发送者
  {
    return _sender;
  }

  EventReceiver* getReceiver() const           //事件接受者
  {
    return _recver;
  }

  // $$构造函数
 public:
  Event();
  Event( long _id );
  virtual ~Event(){};							//虚函数防止有些事件动态内存泄漏

  // $$供EventSender调用的接口
 private:
  void           setSender( EventSender* _s )
  {
    _sender = _s;
  }
  void           setReceiver( EventReceiver* _r )
  {
    _recver = _r;
  }
  friend class   EventSender;

  // $$内部数据结构
 private:
  EventSender    *_sender;
  EventReceiver  *_recver;
  // $$事件类型枚举
 public:
  enum{
	//	0
	EVENT_MAIN_THREAD_EXIT,
	EVENT_MAIN_THREAD_HUNG,
	IOEVENT_SAVE_FINISH,
	IOEVENT_LOAD_FINISH,
	IOEVENT_SAVE_FAILED,
	// 5
	IOEVENT_LOAD_FAILED
  };
};

#define CUSTOM_EVENT_START 0x10000

#endif//_EVENT_HPP_
